<template>
  <div id="app">
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive" />
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive" />
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      include: [],
    };
  },
  watch: {
    $route(to, from) {
      if (this.$router.path == "/login") {
        this.$mui.plusReady(() => {
          let exitApp = !1;
          this.$mui.back = () => {
            if (this.$mui.os.ios) return;
            if (exitApp) {
              if (window.plus) window.plus.runtime.quit();
              return;
            }
            Toast.fail("再按一次退出应用");
            exitApp = !0;
            setTimeout(() => {
              exitApp = !1;
            }, 2000);
          };
        });
      } else {
        this.$mui.plusReady(() => {
          this.$mui.back = () => {
            this.$router.go(-1);
          };
        });
      }
    },
  },
};
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;

  background: #f5f5f5;
  width: 100%;
  // height: 100%;
  min-height: 100vh;
  // background: black;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
#nprogress .bar {
  background: rgb(2, 255, 2) !important; //自定义颜色
  background-image: linear-gradient(
    211deg,
    rgb(2, 255, 2) 0%,
    rgb(0, 185, 0) 100%
  );
}
</style>
